package cn.kgc.javaweb.utils;

import cn.hutool.json.JSONUtil;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;

/**
 * @author: mosin
 * @version: v1.0  2022/6/9
 */
public final class ResponseUtil {

   private  ResponseUtil(){}
   public static void write(HttpServletResponse resp,Object object) throws IOException {

       resp.setContentType("application/json;charset=utf-8");
       PrintWriter writer = resp.getWriter();
       writer.write(JSONUtil.toJsonStr(object));
       writer.close();

   }

}
